package com.tang.service;

import com.tang.service.impl.ConsoleLogger;
import com.tang.service.impl.ErrorLogger;
import com.tang.service.impl.FileLogger;

/**
 * 责任链组装
 *
 * @author fulin.tang
 * @version V3.0
 * @since 2021/9/30 17:15
 */
public class LoggerHolder {

    public static AbstractLogger getChainOfLoggers() {
        AbstractLogger errorLogger = new ErrorLogger(AbstractLogger.ERROR);
        FileLogger fileLogger = new FileLogger(AbstractLogger.DEBUG);
        ConsoleLogger consoleLogger = new ConsoleLogger(AbstractLogger.INFO);

        errorLogger.setNextLogger(fileLogger);
        fileLogger.setNextLogger(consoleLogger);

        return errorLogger;
    }

}
